package com.wangsd.web.coupon.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

@Data
@Entity
@Table(name = "product")
@ApiModel(value = "商品", description = "商品")
public class Product {

    @ApiModelProperty(value = "id")
    /*mybatis plus 自增主键*/
    @TableId(type = IdType.UUID)
    @Id
    private String id;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private Date createdTime;

    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updatedTime;

    @ApiModelProperty(value = "（逻辑删除）是否已删；0，未删，1，已删")
    @TableLogic
    @TableField(fill = FieldFill.INSERT)
    private Integer deleted;

    @ApiModelProperty(value = "商品名称")
    private String name;

    @ApiModelProperty(value = "生效开始时间")
    private String beginTime;

    @ApiModelProperty(value = "生效结束时间")
    private String endTime;

    @ApiModelProperty(value = "描述")
    @Lob
    @Column(name = "note", columnDefinition = "text")
    private String note;

    @ApiModelProperty(value = "0未上架，1上架")
    @Column(name = "state", columnDefinition = "int(2) default 0 not null")
    private Integer state;

    @ApiModelProperty(value = "排序字段")
    @Column(name = "sort", columnDefinition = "int(20) default 0 not null")
    private Integer sort;

    @ApiModelProperty(value = "商圈(公司)id")
    private Long companyId;

    @ApiModelProperty(value = "1，商品；2，收费优惠券；3，积分兑换优惠券")
    private Integer type;

    @ApiModelProperty(value = "商品编码")
    private Integer productNo;

    @ApiModelProperty(value = "商品价值")
    private Integer value;

    @ApiModelProperty(value = "收费代金券面额")
    private Integer productCouponValue;

    @ApiModelProperty(value = "收费代金券使用最低限额")
    private Integer productCouponMininumn;

    @ApiModelProperty(value = "商品数量")
    private Integer productCount;

    @ApiModelProperty(value = "剩余商品数量")
    @Column(name = "usable_product_count", columnDefinition = "int(20) default 0 not null")
    private Integer usableProductCount;

    @ApiModelProperty(value = "优惠券图片url")
    private String productPicUrl;

    @ApiModelProperty(value = "检索标识")
    private String code;

    @ApiModelProperty(value = "门店id")
    private String storeId;

    @ApiModelProperty(value = "可以获取多少积分")
    @Column(name = "points", columnDefinition = "int(11) default 0 not null")
    private Integer points;

    @ApiModelProperty(value = "收费优惠券批次号")
    private String stockId;

    @ApiModelProperty(value = "类别id")
    private Long categoryId;

    @ApiModelProperty(value = "商圈（公司名称）")
    @Transient
    @TableField(exist = false)
    private String companyName;

    @ApiModelProperty(value = "是否有效，0 未失效，1 失效")
    @Transient
    @TableField(exist = false)
    private Integer isExpired;

    @ApiModelProperty(value = "来源：1,新人礼；2,大转盘")
    @Transient
    @TableField(exist = false)
    private Integer sourceType;

    @ApiModelProperty(value = "门店对象")
    @Transient
    @TableField(exist = false)
    private Store store;

    @ApiModelProperty(value = "子商户id")
    @Transient
    @TableField(exist = false)
    private String subMchId;

}

